cppunit="cppunit-1.12.1.tar.gz"
if [ ! -f "$cppunit" ]; then
	wget http://nchc.dl.sourceforge.net/project/cppunit/cppunit/1.12.1/cppunit-1.12.1.tar.gz
fi

apr="apr-1.5.2.tar.gz"

if [ ! -f "$apr" ];  then
	wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz
fi

apr_util="apr-util-1.5.4.tar.gz"

if [ ! -f "$apr" ]; then
	wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
fi

apr_iconv="apr-iconv-1.2.1.tar.gz"
if [ ! -f "$apr_iconv" ]; then
	wget http://mirrors.hust.edu.cn/apache//apr/apr-iconv-1.2.1.tar.gz
fi

openssl="openssl-1.0.0a.tar.gz"

if [ ! -f "$openssl" ]; then
	wget http://www.openssl.org/source/openssl-1.0.0a.tar.gz
fi

activemq="activemq-cpp-library-3.9.3-src.tar.gz"
if [ ! -f "$activemq" ]; then
	wget http://mirror.bit.edu.cn/apache/activemq/activemq-cpp/3.9.3/activemq-cpp-library-3.9.3-src.tar.gz
fi

#unzip
cppunit_dir=${cppunit%.tar.gz}
if [ ! -d "$cppunit_dir" ]; then
	tar -vxf $cppunit
fi

apr_dir=${apr%.tar.gz}

if [ ! -d "$apr_dir" ]; then
	tar -vxf $apr
fi

apr_util_dir=${apr_util%.tar.gz}
if [ ! -d "$apr_util_dir" ]; then 
	tar -vxf $apr_util
fi

apr_iconv_dir=${apr_iconv%.tar.gz}
if [ ! -d "$apr_iconv_dir" ]; then 
	tar -vxf $apr_iconv
fi

openssl_dir=${openssl%.tar.gz}
if [ ! -d "$openssl_dir" ]; then
	tar -vxf $openssl
fi

activemq_dir=${activemq%-src.tar.gz}
if [ ! -d "$activemq_dir" ]; then
	tar -vxf $activemq
fi

project_dir=`pwd`

cd $cppunit_dir
./configure --prefix=/usr/local/cppunit
make 
make install

cd $project_dir
cd $apr_dir
./configure --prefix=/usr/local/apr/
make
make install

cd $project_dir
cd $apr_util_dir
./configure --prefix=/usr/local/aprutil --with-apr=/usr/local/apr/
make
make install

cd $project_dir
cd $apr_iconv_dir
./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr/
make
make install

cd $project_dir
cd $openssl_dir
./config --prefix=/usr/local/openssl/
make
make install


cd $project_dir
cd $activemq_dir
./configure --prefix=/usr/local/ActiveMQ-CPP --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/aprutil --with-cppunit=/usr/local/cppunit --with-openssl=/usr/local/openssl/
make
make install









